package com.example.arithmeticleetcode.learnArithmetic2.sort;

/**
 * @program: arithmetic-leetcode
 * @description: 休眠排序
 * @author: FangZhen
 * @create: 2020-11-10 10:39
 **/
public class SortThread extends Thread {

    private int value;

    public SortThread(int value) {
        this.value = value;
    }


    @Override
    public void run() {
        try {
            Thread.sleep(value);
            System.out.println(value);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

class Test {
    public static void main(String[] args) {
        int[] arr = {100, 20, 30, 31, 50};
        for (int i : arr) {
            new SortThread(i).start();
        }
    }
}
